{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true,
    "pycharm": {
     "is_executing": true
    }
   },
   "outputs": [],
   "source": [
    "product_list = [[\"爱马仕\", 120],\n",
    "                [\"古驰\", 100],\n",
    "                [\"迪奥\", 125],\n",
    "                [\"芬迪\", 90],\n",
    "                [\"香奈儿\", 115],\n",
    "                [\"路易威登\", 95],\n",
    "                [\"普拉达\", 90],\n",
    "                [\"范思哲\", 100],\n",
    "                [\"阿玛尼\", 105]]\n",
    "shopping_car = []\n",
    "\n",
    "alipay = int(input(\"请输入您的余额\"))\n",
    "while True:\n",
    "    print('-' * 50 + \"欢迎来到香榭丽舍\" + '-' * 50)\n",
    "    for i in range(9):\n",
    "        print(\"商品编号：\" + str(i), product_list[i])\n",
    "    user_choice = input(\"请输入商品编号\")\n",
    "    if user_choice.isdigit():\n",
    "        if alipay >= product_list[int(user_choice)][1]:\n",
    "            alipay = alipay - product_list[int(user_choice)][1]\n",
    "            shopping_car.append(product_list[int(user_choice)])\n",
    "            print(\"您本次所选购的商品已放进购物车，您的存款余额还剩:\", alipay)\n",
    "        else:\n",
    "            print(\"余额不足，换支付方式\")\n",
    "    elif user_choice == \"q\":\n",
    "        print(\"您的购物车:\", shopping_car)\n",
    "        print(\"您的余额还有：\", alipay)\n",
    "        break"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 2
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython2",
   "version": "2.7.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 0
}
